﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using UnityEngine;

public class AirWallGenerator : MonoBehaviour
{
    [CompilerGenerated]
    private static Func<Transform, Vector3> <>f__am$cache0;

    private void Start()
    {
        Vector3[] vectorArray = new Vector3[] { new Vector3(1f, 0f, 0f), new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 1f), new Vector3(0f, 0f, -1f), new Vector3(1f, 0f, 1f), new Vector3(-1f, 0f, -1f), new Vector3(1f, 0f, -1f), new Vector3(-1f, 0f, 1f) };
        if (<>f__am$cache0 == null)
        {
            <>f__am$cache0 = x => x.position.SetY(0f).Snap((float) 1f);
        }
        HashSet<Vector3> set = new HashSet<Vector3>(base.transform.GetComponentsInChildren<Transform>().Select<Transform, Vector3>(<>f__am$cache0));
        HashSet<Vector3> set2 = new HashSet<Vector3>();
        foreach (Vector3 vector in set)
        {
            foreach (Vector3 vector2 in vectorArray)
            {
                Vector3 item = vector + vector2;
                if (!set.Contains(item))
                {
                    set2.Add(item);
                }
            }
        }
        GameObject obj2 = base.transform.CreateChildGameObject("AirWalls");
        foreach (Vector3 vector4 in set2)
        {
            BoxCollider collider = new GameObject("AirWall").AddComponent<BoxCollider>();
            collider.size = new Vector3(1f, 10f, 1f);
            collider.transform.position = vector4;
            collider.transform.parent = obj2.transform;
        }
    }
}

